//************************************************************
//	COPYRIGHT 2011 Birthin' Hips - ALL RIGHTS RESERVED
//************************************************************
//
//	$Id: StatusUpdate.java$
//
//	$Date: 12/13/11$
//
//	Reason:  Message that holds a String key and a String value
//
//*************************************************************

/** $Author: Colton Presler, Ross Kahn, Elysia Haight$ */
/** $Revision: $ */

package com;
 
//==============================================================
public class StatusUpdate implements Message {

	private String key;			// String key message
	private String value;		// String value message
	
	/**
	 * Constructor for a status message. 
	 * @param key		String corresponding to the key 
	 * @param value		String corresponding to the value
	 */
	public StatusUpdate(String key, String value){
		this.key = key;
		this.value = value;
	}
	
	/**
	 * @return 	key message
	 */
	//----------------------------------------------------------
	public String getKey(){
		return key;
	}
	
	/**
	 * @return value message
	 */
	//----------------------------------------------------------
	public String getValue(){
		return value;
	}
	
	/**
	 * Returns true if a given object is equal to this StatusUpdate message. Comapares the key string
	 * and value string (assuming the given object is a StatusUpdate type. If not, returns false).
	 */
	//----------------------------------------------------------
	public boolean equals(Object o){
		if(o instanceof StatusUpdate){
			StatusUpdate toCompare = (StatusUpdate) o;
			if((toCompare.getKey()).equals(key)){
				if((toCompare.getValue()).equals(value)){
					return true;
				}else{
					return false;
				}
			}else{
				return false;
			}
		}else{
			return false;
		}
	}
	
	
	/**
	 * Converts this StatusUpdate message to a String
	 */
	//----------------------------------------------------------
	public String toString(){
		return "Key: " + key + "; Value: " + value;
	}
}
